package cn.tedu.oopextends;
/**本类用于测试继承的用法*/
public class TestExtends1 {
    public static void main(String[] args) {
        Son s=new Son();
        s.eat();
    }
}
class grandFather{
    int sum=1111;
}
class Father extends grandFather{
    int sum=10;
    static String name="爸爸";
}
class Son extends Father{
    int sum=100;
    public void eat(){
        int sum=1000;
        String name="儿子";
        System.out.println(sum);
        System.out.println(this.sum);
        /**关键字 super代表父类 Father super=new Father()
         * 所以想指定同名的父类成员变量时，使用super来指定*/
        System.out.println(super.sum);
        Father a=new Father();
        System.out.println(super.name);//Static member 'cn.tedu.oopextends.Father.name' accessed via instance reference
    }
}
